@extends("admin.base.base")
@section("title")
<title>新增图片</title>
<link href="{{asset('lib/webuploader/0.1.5/webuploader.css')}}" rel="stylesheet" type="text/css" />
<link href="{{asset('css/admin/css/examine.css')}}" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="{{asset('js/admin/zoom.js')}}"></script>
<script type="text/javascript" src="{{asset('js/admin/enlarge.js')}}"></script>
<script src="http://www.jq22.com/jquery/jquery-1.10.2.js"></script>
<script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
@endsection
@section("content")
<div class="page-container">
	<form class="form form-horizontal" id="form-article-add">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">认证基地：</label>
            <div class="formControls col-xs-3 col-sm-3">
                <span>{{$item->name}}</span>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">认证基地类别：</label>
            <div class="formControls col-xs-3 col-sm-3">
                @foreach($category as $categorys)
                    @if($categorys->id == $item->category)
                        <span>{{$categorys->classify}}</span>
                    @endif
                @endforeach
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">主办方证件类型：</label>
            <div class="formControls col-xs-3 col-sm-3">
                <span>{{$item->sponsor_certificates_type}}</span>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">主办方证件号码：</label>
            <div class="formControls col-xs-3 col-sm-3">
                <span>{{$item->sponsor_certificates_number}}</span>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">主办方证件所在地：</label>
            <div class="formControls col-xs-3 col-sm-3">
                <span>{{$item->sponsor_certificates_location}}</span>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">主办方单位名称：</label>
            <div class="formControls col-xs-3 col-sm-3">
                <span>{{$item->sponsor_name}}</span>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">主办方营业执照：</label>
            <div class="formControls col-xs-3 col-sm-3">
                <img class="smallimg" src="{{$item->business_license}}">
                {{--<img class="click-img2" src="{{asset('img/admin/enlarge.png')}}">--}}
            </div>
        </div>
        <img src="" alt="" class="bigimg">
        <div class="mask">
            <img src="{{asset('img/admin/close.png')}}" alt="">
        </div>
        <div class="row cl basic-point">
            <label class="form-label col-xs-4 col-sm-2">主办方基地授牌：</label>
            <div class="formControls col-xs-3 col-sm-3">
                <img class="small" src="{{$item->base_licensing}}" style="width: 400px;">
                {{--<img class="click-img" src="{{asset('img/admin/enlarge.png')}}">--}}
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">负责人证件号码：</label>
            <div class="formControls col-xs-3 col-sm-3">
                <span>{{$item->person_in_charge_number}}</span>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">负责人电话号码：</label>
            <div class="formControls col-xs-3 col-sm-3">
                <span>{{$item->person_in_charge_tel}}</span>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">电子邮件：</label>
            <div class="formControls col-xs-3 col-sm-3">
                <span>{{$item->email}}</span>
            </div>
        </div>

		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
                <button class="btn btn-success" type="button">&nbsp;&nbsp;通过审核&nbsp;&nbsp;</button>
                <button class="btn btn-danger btn-lg" data-toggle="modal" data-target="#myModal" type="button">&nbsp;&nbsp;审核不通过&nbsp;&nbsp;</button>
                <button onClick="layer_close();" class="btn btn-dark" type="button">&nbsp;&nbsp;返回&nbsp;&nbsp;</button>
			</div>
		</div>
        {{csrf_field()}}
        {{method_field('PUT')}}
	</form>
    <!-- 模态框（Modal） -->
    <form id="problem-feedback" action="{{url('admin/handle')}}" method="post">
        <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                            &times;
                        </button>
                        <h4 class="modal-title" id="myModalLabel" style="font-weight: 700">
                            请填写审核不能通过原因...
                        </h4>
                    </div>
                    <div class="modal-body">
                        <textarea rows="10" cols="90" name="reason" id="feedback"></textarea>
                    </div>
                    {{csrf_field()}}
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭
                        </button>
                        <button type="button" class="btn btn-primary sub">
                            提交原因
                        </button>
                    </div>
                    <input type="hidden" value="{{csrf_token()}}">
                </div><!-- /.modal-content -->
            </div><!-- /.modal -->
        </div>
    </form>
</div>
@endsection
@section("js")
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="{{asset('lib/jquery.validation/1.14.0/jquery.validate.js')}}"></script>
<script type="text/javascript" src="{{asset('lib/jquery.validation/1.14.0/validate-methods.js')}}"></script>
<script type="text/javascript" src="{{asset('lib/jquery.validation/1.14.0/messages_zh.js')}}"></script>
<script>
    $(function(){
        /*
         smallimg   // 小图
         bigimg  //点击放大的图片
         mask   //黑色遮罩
         */
        var obj = new zoom('mask', 'bigimg','smallimg');
        obj.init();
    });
    $(function(){
        /*
         small   // 小图
         bigimg  //点击放大的图片
         mask   //黑色遮罩
         */
        var obj = new zoom('mask', 'bigimg','small');
        obj.init();
    })

</script>
<script type="text/javascript">
    $(".btn-success").click(function () {
        var formData = $('#form-article-add').serializeArray();
        $.ajax({
            type:'POST',
            url:"{{url('admin/examine/'.$item->id)}}",
            data:formData,
            dataType:'json',
            success:function (resp) {
                if (resp.code == 0){
                    layer.msg(resp.msg);
                    setTimeout(function () {
                        window.location.href = '{{url('admin/examine')}}';
                    },1000);
                }else {
                    layer.msg(resp.msg);
                }
            }
        });
    });
    $(".sub").click(function () {
        var data = $("#feedback").val();
        if (data == ''){
            layer.tips('请填写审核不通过原因', '#feedback');
        }
        $.post("{{url('admin/examine')}}",{'_token':"{{csrf_token()}}",data:data,eid:"{{$item->id}}"},function (resp) {
            if (resp.code == 0){
                layer.msg(resp.msg, {
                    offset: 't',
                    anim: 6
                });
                setTimeout(function () {
                    window.location.href = '{{url('admin/examine')}}';
                },1000);
            }else {
                layer.tips(resp.msg, '#feedback');
            }
        })
    });
</script>
@endsection